/* eslint-disable */
<template>
<div class="rating_page">
     <head-top head-title="培训反馈" go-back='true'></head-top>
   <div>
      <group label-width="4.5em" label-margin-right="2em" label-align="right">
          <group title="第一部分">
          <group title="1、课程目标">
          <cell title="这个课程的目标与我的工作相关"><rater v-model="fd.rele"></rater></cell>
          <cell title="我抓住了主题概念"><rater v-model="fd.sub"></rater></cell>
          <cell title="我有了行动的方向并清楚当中的困难"><rater v-model="fd.cour"></rater></cell>
          <cell title="课程内容达到了我的期望程序"><rater v-model="fd.expe"></rater></cell>
          </group>
          <group title="2、课程设计和安排">
          <cell title="课程内容组织符合逻辑，易于学习"><rater v-model="fd.easy"></rater></cell>
          <cell title="课程的程序安排妥当和顺畅"><rater v-model="fd.smoo"></rater></cell>
          <cell title="课程难易度适中，容易理解"><rater v-model="fd.mode"></rater></cell>
          <cell title="所学的知识和技巧能在工作中运用"><rater v-model="fd.appl"></rater></cell>
          </group>
          <group title="3、培训讲师">
          <cell title="课前准备充分"><rater v-model="fd.pre"></rater></cell>
          <cell title="讲解十分清楚"><rater v-model="fd.cle"></rater></cell>
          <cell title="课程中使用的练习、讨论都是有效的"><rater v-model="fd.work"></rater></cell>
          <cell title="使用的录像、投影灯有效帮助我学习"><rater v-model="fd.help"></rater></cell>
           <cell title="有很多机会让我参与"><rater v-model="fd.part"></rater></cell>
          <cell title="有足够时间让我练习所学技巧"><rater v-model="fd.exer"></rater></cell>
          </group>
          <group><cell title="你对课程的总体评价"><rater v-model="fd.judg"></rater></cell></group>
          </group>
          <group title="第二部分 书面评论">
            <x-input title="本次培训您觉得最有价值的是什么?" disabled></x-input>
            <x-textarea :max="500"  v-model="fd.wort"></x-textarea>
             <x-input title="本次培训您觉得最不喜欢的是什么?" disabled></x-input>
            <x-textarea :max="500"  v-model="fd.disl" :autosize="true"></x-textarea>
             <x-input title="如果我们再做这个培训，您建议我们做什么调整?" disabled></x-input>
            <x-textarea :max="500"  v-model="fd.adju" :autosize="true"></x-textarea>
            <!-- <x-textarea :max="500" title="本次培训您觉得最不喜欢的是什么?" v-model="fd.disl" :autosize="true"></x-textarea>
            <x-textarea :max="500" title="如果我们再做这个培训，您建议我们做什么调整?" v-model="fd.adju" :autosize="true"></x-textarea> -->
          </group>
 
          </group>
    </div>
           <x-button v-if="showButton" mini plain type="primary" @click.native="fdSub()" link="BACK">提交</x-button>
          <x-button v-if="showButton" mini plain type="warn" link="BACK">取消</x-button>
</div>
</template>
<script>
import {
  CellFormPreview,
  Group,
  Cell,
  XButton,
  XTextarea,
  Rater,
  XInput
} from "vux";
import headTop from "src/components/head";
import { getFdDetail, fdUp } from "src/service/actual";
export default {
  name: "fdDetail",
  data() {
    return {
      sys: "",
      eventId: "",
      userInfo: null,
      task: [],
      showButton: false,
      fd: {
        id: undefined,
        rele: "5",
        sub: "5",
        cour: "5",
        expe: "5",
        easy: "5",
        smoo: "5",
        mode: "5",
        appl: "5",
        pre: "5",
        cle: "5",
        work: "5",
        help: "5",
        part: "5",
        exer: "5",
        judg: "5",
        wort: undefined,
        disl: undefined,
        adju: undefined
      }
    };
  },
  components: {
    headTop,
    CellFormPreview,
    Group,
    Cell,
    XButton,
    XTextarea,
    Rater,
    XInput
  },
  mounted() {
    this.getDetail();
  },
  created() {
    this.eventId = this.$route.query.eventId;
    this.code = this.$route.query.code;
    this.userInfo = this.$store.state.user;
    console.log("created-this.userInfo", this.userInfo);
    this.fd.code = this.userInfo.user_code;
    this.fd.name = this.userInfo.user_name;
    // this.sys = this.$route.query.sys;
  },
  methods: {
    //   培训反馈信息页面展示
    getDetail() {
      getFdDetail({
        eventId: this.eventId,
        code: this.code
        // sys: this.sys
      }).then(response => {
        if (response.status === 200 && response.data.code === 2000) {
          //    this.taskList = response.data;
          //  this.dealSearch();
          // console.log("this.task", this.task);
          // console.log("this.getAcDetail", response.data);
          this.fd = response.data.fd;
          this.showButton = false;
        } else if (response.data.code === 2500) {
            this.showButton = true;
          console.log("未获取到已提交信息，直接创建???");
          console.log(this.eventId);
        } else {
          console.log(response);
          this.$notify({
            title: "失败",
            message: response.status + response.data.msg,
            type: "error",
            duration: 2000
          });
        }
      });
    },
    // 提交培训反馈信息
    fdSub() {
      fdUp({
        actualId: this.eventId,
        fd: this.fd
      }).then(response => {
        if (response.status === 200 && response.data.code === 2000) {
        //   console.log(this.fd);
        //   console.log(response);
          this.$notify({
            title: "成功",
            message: "提交成功",
            type: "success",
            duration: 2000
          });
        } else {
          this.$notify({
            title: "失败",
            message: response.status + response.data.msg,
            type: "error",
            duration: 2000
          });
        }
      });
    }
  }
};
</script>
<style lang="less" scoped>
@import "~vux/src/styles/1px.less";
@import "~vux/src/styles/center.less";
.rating_page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  overflow: scroll;
}
</style>
